package com.cy.dda.web.front.goodsdiligencing;

import com.cy.dda.model.PageBean;
import com.cy.dda.model.Result;
import com.cy.dda.model.query.goodsdiligencing.GoodsDiligencingListQuery;
import com.cy.dda.model.vo.goodsdiligencing.GoodsDiligencingListVO;
import com.cy.dda.model.vo.goodsdiligencing.GoodsDiligencingStatusVO;
import com.cy.dda.service.goodsdiligencing.GoodsDiligencingService;
import com.cy.dda.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 前台-家具尽调
 * @Author tanyilin
 * @Date 2019/8/27 14:48
 */
@RestController
@RequestMapping("/user/goods/diligencing")
@Api(tags = "前台-家具尽调")
public class GoodsDiligencingController extends BaseController {

    @Autowired
    private GoodsDiligencingService goodsDiligencingService;

    @ApiOperation("家具尽调列表")
    @GetMapping("/get/list")
    public PageBean<GoodsDiligencingListVO> getList(GoodsDiligencingListQuery query) {

        query.setUserId(this.getUser().getUserId());
        PageBean<GoodsDiligencingListVO> pageBean = goodsDiligencingService.getGoodsDiligencingList(query);
        return pageBean;
    }

    @ApiOperation("家具尽调详情")
    @GetMapping("/get/detail")
    public Result getDetail(@RequestParam(value = "goodsDiligencingId") Long goodsDiligencingId) {

        return goodsDiligencingService.getGoodsDiligencingDetail(goodsDiligencingId);
    }

    @ApiOperation("家具尽调相关状态")
    @GetMapping("/get/status")
    public Result<GoodsDiligencingStatusVO> getStatus(@RequestParam(value = "goodsDiligencingId") Long goodsDiligencingId) {

        GoodsDiligencingStatusVO statusVO = goodsDiligencingService.getGoodsDiligencingStatus(goodsDiligencingId);
        return ok("", statusVO);
    }

}
